home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 48
/
048side1.d81
/
bulls & bears
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
9KB
|
281 lines
0 gosub60100:print"[147]":x=rnd(-ti):poke53280,13:poke53281,1
5 print""spc(12)"bulls and bears[146]":print""
10 dimn$(20),d(20),p(20),c(20),p1(20),p2(20),sp(12),b(20),i$(9),s(20)
15 c=7:gosub980:print"[144]number of players (1/2)"
16 geta$:ifa$<"1"ora$>"2"then16
17 np=val(a$)
20 ifnp>2ornp<1thenprint"[145][145]":goto15
25 c=9:gosub980:print"[144]player 1 initials:";:al=1:nu=.:le=3:gosub60500:p1$=c$
30 iflen(p1$)<>3thenprint"[145][145][145]":goto25
35 ifnp=1then50
40 print:gosub980:print"player 2 initials:";:gosub60500:p2$=c$
45 iflen(p2$)<>3thenprint"[145][145][145]":goto40
50 yr=1:i3=6:m(1)=10000:m(2)=10000:pl=1
55 forx=1to12:readn$(x),d(x):p(x)=100:next
60 p(11)=120:forx=1to8:readi$(x):next:forx=13to20:readn$(x),p(x):next
65 print"[147]":s1=0:s2=0:forx=1to20:s1=s1+p1(x)*p(x):s2=s2+p2(x)*p(x):next
70 n1=int(m1*.02):n2=int(m2*.02)
75 ifm(1)<0thenn1=n1-int(m(1)*.02)
80 ifm(2)<0thenn2=n2-int(m(2)*.02)
85 m(1)=m(1)-n1+d1:m(2)=m(2)-n2+d2:t1=s1+m(1)-m1:t2=m(2)+s2-m2
90 print" year:"yr" quarter:"q:gosub1025
95 printtab(18)p1$:printtab(18)"[192][192][192]"
100 print"stocks"spc(15-len(str$(s1)))""s1
105 ifm(1)<0thenprint"[144]cash"spc(17-len(str$(m(1))))""m(1):goto115
110 print"[144]cash"spc(17-len(str$(m(1))))""m(1)
115 print"[144]dividends"spc(12-len(str$(d1)))""d1
120 print"[144]margins"spc(14-len(str$(m1)))""m1
125 print"[144]interest"spc(13-len(str$(n1)))""n1
130 printspc(15)"[144][192][192][192][192][192][192]":print"total"spc(16-len(str$(t1)))t1
135 ifnp=1then175
140 print""spc(30)"[144]"p2$:printspc(30)"[192][192][192]"
145 printspc(33-len(str$(s2)))""s2
150 ifm(2)<0thenprintspc(33-len(str$(m(2))))""m(2):goto160
155 printspc(33-len(str$(m(2))))""m(2)
160 printspc(33-len(str$(d2)))""d2
165 printspc(33-len(str$(m2)))""m2:printspc(33-len(str$(n2)))n2
170 printspc(27)"[144][192][192][192][192][192][192]":printspc(33-len(str$(t2)))t2
175 print:print:print"press space[146] to continue or q[146] to quit":poke198,0
180 geta$:ifa$=""then180
182 ifa$="q"then60000
185 ifa$<>chr$(32)then180
190 ifbr(1)=1orbr(2)=1then1105
195 ifyr=10andq=4then1105
200 print"[147]":gosub1090
205 ifen>9theny=y-1
210 ifen<-5theny=y+1
215 en=en+y:c1=y:gosub1090
220 ifi1>9theny=y-1
225 ifi1<-5theny=y+1
230 i1=i1+c1+y:c2=c1+y:gosub1090
235 ify=-2theny=0
240 i2=i2+c2+y:c3=c2+y:gosub1090:i3=i3+y:c4=y
245 ifi2<-6theni2=i2+1:c3=c3+1
250 ifi1-i3>2theni3=i3+1:c4=c4+1
255 ifi1-i3<-2theni3=i3-1:c4=c4-1
260 ifi3<2theni3=2:c4=0
265 ifi3<5theni1=i1+1:c2=c2+1
270 ifi3>12theni1=i1-1:c2=c2-1
275 d(12)=i3-2
280 ifd(12)<4thend(12)=4
285 ifd(12)>9thend(12)=9
290 gosub1100:c(1)=(c3-c4)*y:c(11)=-(10*c4)
295 ifp(11)>160thenc(11)=0
300 ifp(11)<70thenc(11)=c(11)+5
305 gosub1100:c(4)=(c2+c3)*y:gosub1100:c(5)=(c2+c3)*y-2
310 gosub1100:c(9)=c1*y*2:gosub1100:c(7)=(c3-c4-c1)*y
315 gosub1100:c(6)=c3*y:gosub1100:c(3)=-(c1+c4)*y*2
320 gosub1100:c(10)=(c2+c4)*y*2:gosub1100:c(2)=-(c2+c4)*y*2
325 gosub1100:c(8)=-c1*y:c(9)=c(9)+c1:c(10)=c(10)+(5*c2):gosub1100
330 ifi2>5thenc(4)=c(4)+y:c(7)=c(7)+y:c(6)=c(6)+y
335 ifi2<0thenc(4)=c(4)-y:c(7)=c(7)-(y*2):c(6)=c(6)-(y*2)
340 gosub1100
345 ifi3>10thenc(1)=c(1)-(2*y):c(2)=c(2)-(3*y):c(3)=c(3)-y
350 ifi3<5thenc(1)=c(1)+(2*y):c(2)=c(2)+(3*y):c(3)=c(3)+y
355 forx=1to10:y=int(rnd(1)*10)
360 ify>6theny=y-10
365 c(x)=c(x)+(2*y):next
370 forx=1to11
375 ifb(x)=1thenp(x)=100:b(x)=0
380 p(x)=p(x)+c(x)
385 ifp(x)=<0thenp(x)=0:b(x)=1
390 ifp(x)>199thenp(x)=int(p(x)/2):sp(x)=1
395 next
400 forx=1to10:ifsp(x)=0thennext:goto410
405 p1(x)=p1(x)*2:p2(x)=p2(x)*2:sp(x)=1:next
410 forx=13to(12+ip)
415 ifb(x)=0thennextx:goto430
420 ifb(x)=1thenb(x)=2
425 next
430 forx=13to(12+ip):gosub1090:p(x)=p(x)+y
435 ifp(x)>0thennext:goto450
440 ifb(x)=2thennext:goto450
445 p1(x)=0:p2(x)=0:p(x)=0:b(x)=1:next
450 q=q+1:ifq=5thenq=1:yr=yr+1
455 ifnp=1orpl=1then470
460 pl$=p2$:m=m(2):mt=m2:tl=m-mt
463 forx=1to20:s(x)=p2(x):tl=tl+s(x)*p(x):next
465 goto475
470 pl$=p1$:m=m(1):mt=m1:tl=m-mt
473 forx=1to20:s(x)=p1(x):tl=tl+s(x)*p(x):next
475 gosub1035:iftl<0thenbr(pl)=1
480 print"[147]":print"year:"yr" quarter:"q" player: "pl$
485 print"[144]stk div prc chg shrs [221]stk prc shrs"
490 print"[192][192][192] [192][192][192] [192][192][192] [192][192][192] [192][192][192][192] [221][192][192][192] [192][192][192] [192][192][192][192]"
495 forx=1to12:y=len(str$(s(x))):y1=len(str$(p(x))):z=len(str$(c(x)))
500 print""n$(x)" "d(x)spc(4-y1)p(x)spc(3-z)c(x)spc(6-y)s(x)"[144][221]":next
505 print"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
510 ifpl=2then585
515 ifq<>1oryr>8then525
520 gosub1030:nw=1:ip=ip+1:printspc(6)"new issue: "i$(ip)
525 forx=1to12+ip
530 ifb(x)<>1thennext:goto545
535 ifnw=0thengosub1030:nw=1
540 printspc(6)""n$(x)" declares bankruptcy":next
545 forx=1to11
550 ifsp(x)=0thennext:goto565
555 ifnw=othengosub1030:nw=1
560 printspc(6)""n$(x)" declares 2-for-1 split":sp(x)=0:next
565 ifnw=0then585
570 forx=1to3000:next
575 nw=0:l=15:gosub985
580 forx=1to6:printspc(5)" ":next
583 l=15:gosub985
585 print"[145]"spc(23)"[144][179]"
590 ifbr(pl)=1thenprint" bankrupt[146]":print"[145]"spc(23)"[144][221]":goto605
595 ifmc>0thenprint:goto605
600 print" [144]b[146]uy s[146]ell e[146]xit [221]"
605 print"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][178][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
610 print"":print:print
615 forx=13to12+ip:y=len(str$(s(x))):z=9-len(str$(p(x)))
620 ifb(x)=2thennext:goto630
625 printspc(24)"[156]"n$(x)" "p(x)spc(z-y)s(x):next
630 l=10:gosub985:printspc(23)"[144][171][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
635 printspc(26)" [129]indexes[146]"
640 printspc(24)" energy "en:printspc(24)" economy "i2
645 printspc(24)" interest "i3:printspc(24)" inflation "i1
650 printspc(23)"[144][177][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
655 print"cash="m:print"comm="cm:print"marg="mt
660 print"[145][145][145]"spc(15)"[144][221]":printspc(15)"[221]":printspc(15)"[221]"
665 print"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][177][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
670 ifbr(pl)=0then680
675 forx=1to2000:next:goto1050
680 ifmc=0then700
685 l=15:gosub985:print" margin call:[146]"mc
690 print"[145]"spc(23)"[144][221]"
695 gosub825:mc=mc-x:ifmc>0thenprint"[145][145]"spc(14)" ":goto685
700 fl=-1:poke198,.
701 print"";
702 if(fl)thenprint" [144]b[146]uy s[146]ell e[146]xit "
705 ifnot(fl)thenprint" [144] uy ell xit "
710 geta$:ifa$=""thenfl=not(fl):goto701
711 print" [144]b[146]uy s[146]ell e[146]xit "
715 ifa$="b"thengosub735:goto701
720 ifa$="s"thengosub825:goto701
725 ifa$="e"then1050
730 fl=not(fl):goto701
735 gosub950:mr=0:printspc(21)"[144]buy on margin?":poke198,0
740 geta$:ifa$=""then740
745 ifa$="y"thenmr=1:goto755
750 ifa$<>"n"then740
755 gosub990:ifa$="x"thenreturn
760 ifmr=0then775
765 ifm-z/2<-1000thengosub955:gosub1020:goto765
770 mt=mt+int(z/2):m=m-int(z/2):goto785
775 ifm-z<-1000thengosub955:gosub1020:goto775
780 m=m-z:ifx=0then795
785 s(y)=s(y)+x
790 z=int(x*.1)+1:m=m-z:cm=cm+z+10
795 gosub950
800 printtab(7)" "spc(4)" "
805 printtab(7)" "spc(4)" "
810 printtab(7)" "spc(4)" "
815 gosub950:print"cash="m:print"comm="cm:print"marg="mt
820 gosub890:gosub950:return
825 gosub990:ifa$="x"then845
830 ifx>s(y)thengosub960:gosub1020:goto830
835 m=m+z:s(y)=s(y)-x:gosub790
840 ifmt=0thengosub940:return
845 printspc(22)"[144]pay margin?":poke198,0
850 geta$:ifa$=""then850
855 ifa$="y"then870
860 ifa$="n"thengosub940:return
865 goto850
870 c=22:gosub980:print"amount:";:nu=1:al=.:le=8:gosub60500:x=val(c$)
875 ifm-x<-1000thengosub955:goto870
880 ifx>mtthenx=mt
885 m=m-x:mt=mt-x:goto795
890 z=len(str$(s(y)))
895 ify>12then915
900 ify=0thenreturn
905 l=y+1:gosub985:printspc(17)" "
910 print"[145]"spc(22-z)s(y):return
915 l=y-11:forx=